package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import com.atguigu.springcloud.service.PaymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderFeignController {
    @Resource
    public PaymentService paymentService;
    @GetMapping("/consumer/payment/create")
    public CommonResult<Integer> create(Payment payment){
        return  paymentService.create(payment);
    }
    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        System.out.println("1111111111");
        log.info("查询id="+id);
        return paymentService.getPaymentById(id);
    }
    @GetMapping("/consumer/payment/feign/timeout")
    public int paymentFeignTimeOut(){
        return  paymentService.paymentFeignTimeOut();
    }
}
